import { messages } from "share/common";

export const orderTab = data => {
  let tabMap = ['ONLINE_PAYMENT', 'OFFLINE_PAYMENT', 'EBANK_PAYMENT'];
  data.sort((a,b) => {
    return tabMap.indexOf(a.itemCode) - tabMap.indexOf(b.itemCode);
  });
  return data;
};

export const optionsMap = new Map([
  [1, { itemCode: 'ONLINE_PAYMENT', showName: messages('finance-4.key305')/*线上*/ }],
  [2, { itemCode: 'OFFLINE_PAYMENT', showName: messages('finance-4.key306')/*线下*/ }],
  [4, { itemCode: 'EBANK_PAYMENT', showName: messages('finance-4.key307')/*落地文件*/ }]
]);

export const handleOptions = arr => {
  let newArr = [];
  arr.forEach(item => newArr.push(optionsMap.get(item)));
  return newArr;
};
